#ifndef EdgeAccessor_HPP
#define EdgeAccessor_HPP

#include "GeometryTypes.hpp"
#include <boost/signal.hpp>

class EdgeAccessor
{
public:

   EdgeAccessor(EdgeList* aEdgeList=0) : mEdgeList(aEdgeList) {}

   const Edge& operator[](int aIndex) const
   {
      if (mEdgeList != 0)
      {
         return (*mEdgeList)[aIndex];
      }
      else
      {
         static Edge v;
         return v;
      }
   }

   const EdgeList& Get() const
   {
      if (mEdgeList) return (*mEdgeList);
      static EdgeList v;
      return v;
   }

   EdgeList& Get()
   {
      if (mEdgeList) return (*mEdgeList);
      static EdgeList v;
      return v;
   }

   boost::signal<void()> Updated;

   size_t size() const { if (mEdgeList) return mEdgeList->size(); else return 0; }

   bool IsValid() const { return mEdgeList != 0; }

   void SetEdgeList(EdgeList* aEdgeList) { mEdgeList = aEdgeList; }

private:
   EdgeList*   mEdgeList;
};

#endif